<?php
/**
 * Created by PhpStorm.
 * User: Soha_Ros
 * Date: 17/6/6
 * Time: 下午8:18
 */

namespace ActionsHttp;

use Data\Food_groups_DAO;

class RestaurantFoodGroupsGetRecord extends BaseActionHttp
{
    public function doAction() {

        parent::doAction();

        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;

        $food_group_id = $this->data[FOOD_GROUP_ID];

        $food_group_record = Food_groups_DAO::getRecord($food_group_id);

        if (!$food_group_record) {
            $this->SendErrMsg("没有该商品分类");
        }

        if ($food_group_record->getRESTAURANT_ID() != $restaurant_id) {
            $this->SendErrMsg("非法操作");
        }

        // 获取分类列表
        $this->setValue(Food_groups,$food_group_record->getArray());

        // 返回数据
        $this->ResponseDataToCurrentClient();

    }
}